#-*- coding: utf8 -*-
from tutor.scripts import *
from tutor.plugins.sympy import *

while True:
    with display_block('Entradas'):
        # parâmetros iniciais
        delta = One * oneof(sqrt(2), sqrt(3), 2, 3)
        r0 = 1 / delta
        r1 = 2 / delta
        delta *= delta

        A = oneof(Rational(4, 3), Rational(3, 4))
        Az2 = A ** 2 * z ** 2
        z0 = r0 / A
        z1 = r1 / A

    with display_block('Respostas --- Massas'):
        Mass = pi * delta * (1 + A ** 2) ** (1 * One / 2) * (r1 ** 2 - r0 ** 2) * One / A
        MJacob = (2 * One / 3) * pi * delta * (1 + A ** 2) ** (1 * One / 2) * (r1 ** 3 - r0 ** 3) * One / A
        MAchat = 2 * pi * delta * (r1 - r0)
        MPolar = pi * delta * (r1 ** 2 - r0 ** 2)
        MSumJacob = -(2 * One / 3) * delta * pi * (-r1 ** 3 + r0 ** 3)
        if len(set([Mass, MJacob, MAchat, MPolar, MSumJacob])) != 5:
            pass

    with display_block('Respostas --- Zcms'):
        zcm = (2 * One / 3) * (r1 ** 3 - r0 ** 3) * One / (A * (r1 ** 2 - r0 ** 2))
        zcmJacob = (3 * One / 4) * (r1 ** 4 - r0 ** 4) * One / (A * (r1 ** 3 - r0 ** 3))
        zcmAchat = (1 * One / 2) * (r1 ** 2 - r0 ** 2) * One / (A * (r1 - r0))
        zcmPolar = (2 * One / 3) * (r1 ** 3 - r0 ** 3) * One / (A * (r1 ** 2 - r0 ** 2))
        zcmSumJacob = (3 * One / 4) * (-r1 ** 4 + r0 ** 4) * One / (A * (-r1 ** 3 + r0 ** 3))
        if len(set([zcm, zcmJacob, zcmAchat, zcmPolar, zcmSumJacob])) != 5:
            pass

    with display_block('Respostas --- Izs'):
        Iz = (1 * One / 2) * pi * delta * (1 + A ** 2) ** (1 * One / 2) * (r1 ** 4 - r0 ** 4) * One / A
        Izz = (1 * One / 2) * pi * delta * (1 + A ** 2) ** (1 * One / 2) * (r1 ** 4 - r0 ** 4) * One / A ** 3
        Ixy = -(1 * One / 4) * delta * (1 + A ** 2) ** (1 * One / 2) * pi * (-2 * r1 ** 4 + 2 * r0 ** 4 - r1 ** 4 * A ** 2 + r0 ** 4 * A ** 2) * One / A ** 3
        IJacob = (2 * One / 5) * pi * delta * (1 + A ** 2) ** (1 * One / 2) * (r1 ** 5 - r0 ** 5) * One / A
        IAchat = (2 * One / 3) * pi * delta * (r1 ** 3 - r0 ** 3)
        IPolar = (1 * One / 2) * pi * delta * (r1 ** 4 - r0 ** 4)
        ISumJacob = -(2 * One / 5) * delta * pi * (-r1 ** 5 + r0 ** 5)

        if len(set([Iz, IJacob, IAchat, IPolar, ISumJacob, Izz, Ixy])) != 7:
            pass
    break
